package com.hymall.controller.admin;

import com.hymall.bean.*;
import com.hymall.bean.common.BasePageInfo;
import com.hymall.bean.common.BaseRespVo;
import com.hymall.bean.common.CommonData;
import com.hymall.service.admin.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 关于用户管理模块
 * @Author 徐成喜
 * @Data 2022/7/17 16:30
 */
@RestController
@RequestMapping("admin")
public class AdminAddressController {

    @Autowired
    UserAddressService userAddressService;

    /**
     * @return 返回json，address全部信息
     * @description 接收参数，address的信息
    */
    @RequestMapping("address/list")
    public BaseRespVo address(String name, Integer userId, BasePageInfo info) {
        CommonData<MarketAddress> data =  userAddressService.queryAddress(name,userId,info);
        return BaseRespVo.ok(data);
    }

    /**
     * @return 返回json，collect全部信息
     * @description 接收参数，collect的信息
     */
    @RequestMapping("collect/list")
    public BaseRespVo collect(Integer valueId, Integer userId, BasePageInfo info) {
        CommonData<MarketCollect> data =  userAddressService.queryCollect(valueId,userId,info);
        return BaseRespVo.ok(data);
    }

    /**
     * @description 接收参数，footprint的信息
     * @return
     */
    @RequestMapping("footprint/list")
    public BaseRespVo footprint(Integer goodsId, Integer userId, BasePageInfo info) {
        CommonData<MarketFootprint> data =  userAddressService.queryFootprint(goodsId,userId,info);
        return BaseRespVo.ok(data);
    }

    /**
     * @description 接收参数，history的信息
     * @return
     */
    @RequestMapping("history/list")
    public BaseRespVo history(String keyword, Integer userId, BasePageInfo info) {
        CommonData<MarketSearchHistory> data =  userAddressService.queryHistory(keyword,userId,info);
        return BaseRespVo.ok(data);
    }

    /**
     * @description 反馈模块
     * @return
     */

    @RequestMapping("feedback/list")
    public BaseRespVo feedback(String username, Integer id, BasePageInfo info) {
        CommonData<MarketFeedback> data =  userAddressService.queryFeedback(username,id,info);
        return BaseRespVo.ok(data);
    }
}
